document.getElementById("mm_chinese_name").onclick=function(){
	var name=$("#chinese_name").val()
	if(/^ *$/.test(name)){
		showErrorInfo("姓名不能为空！")
		return false;
	}
	$.ajax({
		"url":"/m_chinese_name/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"type":"POST",
		"data":{"chinese_name":name},
		"success":function(data){
			data=JSON.parse(data)
			if(!data.status){
				showErrorInfo(data.content)
				return false;
			}
			showSuccessNotice()
		}
	})
}

document.getElementById("m_password").onclick=function(){
	var p1=$("#password1").val()
	var p2=$("#password2").val()
	if(/^ *$/.test(p1)){
		showErrorInfo("密码不能为空！")
		return false;
	}
	else if(p1!==p2){
		showErrorInfo("密码不一致！")
		return false;
	}
	$.ajax({
		"url":"/m_password/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"type":"POST",
		"data":{"password":p1},
		"success":function(data){
			data=JSON.parse(data)
			if(!data.status){
				showErrorInfo(data.content)
				return false;
			}
			alert("修改成功")
			
			
		}
	})
}
function getList(){
	$.ajax({
		"url":"/cheungssh/whoami/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"dataType":"jsonp",
		"success":function(data){
			if(!data.status){
				showErrorInfo(data.content)
				return false;
			}
			$("#username").val(data.username)
			$("#user_type").val(data.type)
			$("#chinese_name").val(data.content)
		}
	})
}
getList()
